package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "Return_goods", schema = "CRM", catalog = "")
public class ReturnGoods {
    private int returnId;
    private String returnNumber;
    private Timestamp returnTime;
    private String returnReason;
    private Long returnChager;
    private String retrurnDesc;
    private Long retrunMoney;
    private Integer retrunNumbers;
    private Long ereApprover;
    private String ecrState;
    private Order orderByOrderId;
    private Customer customerByCustomerId;
    private List<ReturnDetails> returnDetailsList;
    private Employee employee;
    private Employee employee2;

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "return_chager",insertable = false,updatable = false)//设置在article表中的关联字段(外键)
    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)//可选属性optional=false,表示author不能为空。删除文章，不影响用户
    @JoinColumn(name = "ere_approver",insertable = false,updatable = false)//设置在article表中的关联字段(外键)
    public Employee getEmployee2() {
        return employee2;
    }

    public void setEmployee2(Employee employee2) {
        this.employee2 = employee2;
    }

    @OneToMany(mappedBy = "returnGoods")
    public List<ReturnDetails> getReturnDetailsList() {
        return returnDetailsList;
    }

    public void setReturnDetailsList(List<ReturnDetails> returnDetailsList) {
        this.returnDetailsList = returnDetailsList;
    }

    @Id
    @Column(name = "return_id")
    @GeneratedValue(generator = "seq",strategy = GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name = "seq",sequenceName = "crm",
            initialValue = 1,allocationSize = 1)
    public int getReturnId() {
        return returnId;
    }

    public void setReturnId(int returnId) {
        this.returnId = returnId;
    }

    @Basic
    @Column(name = "return_number")
    public String getReturnNumber() {
        return returnNumber;
    }

    public void setReturnNumber(String returnNumber) {
        this.returnNumber = returnNumber;
    }

    @Basic
    @Column(name = "return_time")
    public Timestamp getReturnTime() {
        return returnTime;
    }

    public void setReturnTime(Timestamp returnTime) {
        this.returnTime = returnTime;
    }

    @Basic
    @Column(name = "return_reason")
    public String getReturnReason() {
        return returnReason;
    }

    public void setReturnReason(String returnReason) {
        this.returnReason = returnReason;
    }

    @Basic
    @Column(name = "return_chager")
    public Long getReturnChager() {
        return returnChager;
    }

    public void setReturnChager(Long returnChager) {
        this.returnChager = returnChager;
    }

    @Basic
    @Column(name = "retrurn_desc")
    public String getRetrurnDesc() {
        return retrurnDesc;
    }

    public void setRetrurnDesc(String retrurnDesc) {
        this.retrurnDesc = retrurnDesc;
    }

    @Basic
    @Column(name = "retrun_money")
    public Long getRetrunMoney() {
        return retrunMoney;
    }

    public void setRetrunMoney(Long retrunMoney) {
        this.retrunMoney = retrunMoney;
    }

    @Basic
    @Column(name = "retrun_numbers")
    public Integer getRetrunNumbers() {
        return retrunNumbers;
    }

    public void setRetrunNumbers(Integer retrunNumbers) {
        this.retrunNumbers = retrunNumbers;
    }

    @Basic
    @Column(name = "ere_approver")
    public Long getEreApprover() {
        return ereApprover;
    }

    public void setEreApprover(Long ereApprover) {
        this.ereApprover = ereApprover;
    }

    @Basic
    @Column(name = "ecr_state")
    public String getEcrState() {
        return ecrState;
    }

    public void setEcrState(String ecrState) {
        this.ecrState = ecrState;
    }


    @ManyToOne
    @JoinColumn(name = "order_id", referencedColumnName = "order_id")
    public Order getOrderByOrderId() {
        return orderByOrderId;
    }

    public void setOrderByOrderId(Order orderByOrderId) {
        this.orderByOrderId = orderByOrderId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }
}
